/* ****版权所有
 */
package com.wxy.bank.service;

import com.wxy.bank.dao.AccountDao;
import com.wxy.bank.dao.AccountDaoImpl;
import com.wxy.bank.model.Account;

import java.util.List;

/**
 * 账户业务接口的实现类
 * @author wxy
 * @version 1.0
 */
public class AccountServiceImpl implements AccountService{
    /**
     * 负责数据库访问
     */
    AccountDao accountDao = new AccountDaoImpl();

    /**
     * 添加账户的业务方法
     * @param account 账户对象
     * @return 添加成功返回1
     */
    @Override
    public int addAccount(Account account) {
        int flag = accountDao.insertAccount(account);
        return flag;
    }

    @Override
    public List<Account> findAllAccount() {
        List<Account> accountList = accountDao.selectAllAccount();
        return accountList;
    }

    @Override
    public int deleteAccount(Account account) {
        int flag = accountDao.deleteAccount(account);
        return flag;
    }

}
